perm filename SAITRG.DOC[SYS,BGB] blob
sn#001401 filedate 1972-01-03 generic text, type T, neo UTF8
00100 SAITRG - SAIL ACCESSIBLE TRIGNOMETRY FUNCTIONS
00200
00300 Bruce g. Baumgart
00400
00500
00600 The require source file statement for declaring the SAITRG routines is:
00700
00800 REQUIRE "SAITRG[SYS,BGB]" SOURCE_FILE;
00900
01000 The SAIL declarations for the SAITRG routines are:
01100
01200 REQUIRE "SAITRG[SYS,BGB]" LOAD_MODULE;
01300 EXTERNAL REAL PROCEDURE SIN (REAL X);
01400 EXTERNAL REAL PROCEDURE COS (REAL X);
01500 EXTERNAL REAL PROCEDURE SIND (INTEGER I);
01600 EXTERNAL REAL PROCEDURE COSD (INTEGER I);
01700 EXTERNAL REAL PROCEDURE ASIN (REAL X);
01800 EXTERNAL REAL PROCEDURE ACOS (REAL X);
01900 EXTERNAL REAL PROCEDURE SQRT (REAL X);
02000 EXTERNAL REAL PROCEDURE ATAN (REAL X);
02100 EXTERNAL REAL PROCEDURE ATAN2(REAL Y,X);
02200
02300 These routines were plagarized from the FORTRAN library,
02400 translated from MACRO into FAIL, and slightly altered for entry and
02500 return under SAIL conventions which don't require saving and
02600 restoring accumulators.
02700
02800 SIN and COS expect their argument in radians as real numbers.
02900 SIND and COSD take their argument in degrees as integers.
03000
03100 The arc sine and arc cosine are mathematically only defined
03200 for arguments on the interval from -1 to +1 inclusive, however the
03300 ASIN and ACOS compute the following
03400 ASIN(X) = ATAN(X/SQRT(1-X↑2));
03500 ACOS(X) = π/2 - ASIN(X);
03600 ...and consequently will always return values that could be angles.
03700 With proper arguments ASIN returns values between -π/2 and π/2 and
03800 ACOS returns values between 0 and π.
03900
04000 SQRT is the square root function.
04100
04200 The argument for ATAN can be any real number the value
04300 returned will be on the interval from -π/2 to +π/2 inclusive.
04400
04500 ATAN2 takes two real numbers and returns the angle in radians
04600 between the vector to (X,Y) from the orgin and the positive x-axis
04700 unit vector. ATAN2 values lie between -π and +π.
00100 TIMING
00200
00300 The timings given by DEC for 1 micro second core are:
00400
00500 SIN 91 ASIN 149
00600 COS 148 ACOS 166
00700 SQRT 62
00800 ATAN 55 ATAN2 94
00900
01000 The DEC timings are in the ball park with the exception of
01100 COS which only differs from SIN by a move, fadr, jrst which don't
01200 amount to 57 micro seconds of execution time.
01300
01400 I estimate timing as follows:
01500
01600 50 micro seconds: ATAN and SQRT.
01700 100 micro seconds: ATAN2, SIN and COS.
01800 150 micro seconds: ASIN and ACOS.
01900
02000 The SAITRG routines are fully documented in the DEC manual
02100 titled "Science Library and Fortran Utility Routines".